{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">成员列表</li>
            <li class=""><a href="{:url('admin/admin_user/add')}">添加成员</a></li>
        </ul>
        <div class="layui-tab-content">


            <form class="layui-form layui-form-pane" action="{:url('admin/admin_user/index')}" method="get">

                <div class="layui-elem-quote  title-select">
                    <div>
                        <div class="layui-inline">
                            <label class="layui-form-label">输入搜索</label>
                            <div class="layui-input-inline">
                                <input type="text" name="keyword" value="{$keyword}" placeholder="用户名/姓名" class="layui-input">
                            </div>
                        </div>


                        <div class="layui-inline">
                            <label class="layui-form-label">部门选择</label>
                            <div class="layui-input-inline">
                                <select name="group_id"  lay-search="">
                                    {if empty($group_id)}   <option value="">所属部门</option> {/if}
                                    {foreach	$dept_list	as	$key=>$value}
                                    <option value="{$value.id}" {if $group_id==$value.id } selected {/if}>{$value.title}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-inline" style="margin-left:20px">
                            <button class="layui-btn">搜索</button>
                        </div>
                    </div>

                </div>

            </form>
            <hr>

            <div class="layui-tab-item layui-show">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>成员账号</th>
                        <th>姓名</th>
                        <th>邮箱地址</th>
                        <th>手机号码</th>
                        <th>所属部门</th>
                        <th>创建时间</th>
                        <th>最后登录时间</th>
                        <th>最后登录IP</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="admin_user_list" item="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.username}</td>
                        <td>{$vo.real_name}</td>
                        <td>{$vo.email}</td>
                        <td>{$vo.mobile}</td>
                        <td>{$vo.belong_dept}</td>
                        <td>{$vo.create_time}</td>
                        <td>{$vo.last_login_date}</td>
                        <td>{$vo.last_login_ip}</td>
                        <td class="layui-form">
                        <input type="checkbox" name="online_type" value="{$vo.id}" lay-skin="switch"
                               lay-text="ON|OFF" lay-filter="changeStatus"
                               {if $vo.status == 1}
                               checked
                               {/if}
                        ></td>
                        <td>
                            <a href="{:url('admin/admin_user/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            <a href="{:url('admin/admin_user/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                {$admin_user_list->render()}
            </div>
        </div>
    </div>
</div>
{/block}


{block name="script"}

<script type="text/javascript">
    //监听指定开关
    form.on('switch(changeStatus)', function (data) {
        changeStatus(data, 2, '/admin/admin_user/changeStatus');
    });
</script>
{/block}